home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 October: Mac OS SDK / Dev.CD Oct 96 SDK / Dev.CD Oct 96 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / Found / ODUtils / Unused / SIHelper.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-16  |  36.0 KB  |  1,303 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        SIHelper.cpp
  3.  
  4.     Contains:    xxx put contents here xxx
  5.  
  6.     Owned by:    Nick Pilch
  7.  
  8.     Copyright:    
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <3>      1/8/96    TJ        Removed the duplicate function GetSLongAttr
  13.                                     that caused a build break on 68K.
  14.          <2>     5/01/96    NP        1269380: Call ODDisposeAppleEvent, not
  15.                                     AEDisposeDesc to eliminate memory leak.
  16.  
  17.     To Do:
  18. */
  19.  
  20. /*
  21.     File:        SIHelper.cpp
  22.  
  23.     Contains:    Implementation of Mac C++ version of SemanticInterface helper
  24.                 class
  25.  
  26.     Owned by:    Nick Pilch
  27.  
  28.     Copyright:    © 1994 - 1996 by Apple Computer, Inc., all rights reserved.
  29.  
  30.     
  31.     In Progress:
  32. */
  33.  
  34. #ifndef SOM_ODSession_xh
  35. #include "ODSessn.xh"
  36. #endif
  37.  
  38. #ifndef SOM_ODSemanticInterface_xh
  39. #include "SemtIntB.xh"
  40. #endif
  41.  
  42. #ifndef SOM_ODNameResolver_xh
  43. #include "NamRslvr.xh"
  44. #endif
  45.  
  46. #ifndef SOM_ODAppleEvent_xh
  47. #include "ODAplEvt.xh"
  48. #endif
  49.  
  50. #ifndef SOM_ODOSLToken_xh
  51. #include "ODOSLTkn.xh"
  52. #endif
  53.  
  54. #ifndef _SIHELPER_
  55. #include "SIHelper.h"
  56. #endif
  57.  
  58. #ifndef _SIHSHTBL_
  59. #include "SIHshTbl.h"
  60. #endif
  61.  
  62. #ifndef _EXCEPT_
  63. #include "Except.h"
  64. #endif
  65.  
  66. #ifndef _ODMEMORY_
  67. #include "ODMemory.h"
  68. #endif
  69.  
  70. #ifndef __AEOBJECTS__
  71. #include "AEObjects.h"
  72. #endif
  73.  
  74. #ifndef __ERRORS__
  75. #include "Errors.h"
  76. #endif
  77.  
  78. #ifndef __ODDESUTL__
  79. #include "ODDesUtl.h"
  80. #endif
  81.  
  82. #ifndef __SEUTILS__
  83. #include "SEUtils.h"
  84. #endif
  85.  
  86. #pragma segment SIHelper
  87.  
  88. //==============================================================================
  89. // Implementation Notes
  90. //==============================================================================
  91.  
  92. /*
  93. Cover routines for AppleEvent Manager and OSL routines try to mimic these
  94. routines exactly. I consulted the source code for the AE Mgr and the OSL to do
  95. this.
  96. */
  97.  
  98. //==============================================================================
  99. // Local Types
  100. //==============================================================================
  101.  
  102. struct SIGenericKey
  103. {
  104.     ODDescType        key1;
  105.     ODDescType        key2;
  106. };
  107.  
  108. // [gsf] hash table imposes a maxsize limit of 10 bytes
  109. // when aligned for PPC, this struct is 12 bytes
  110.  
  111. #if PRAGMA_ALIGN_SUPPORTED
  112. #pragma options align=mac68k
  113. #endif
  114.  
  115. struct SIGenericValue
  116. {
  117.     UniversalProcPtr    handler;
  118.     ODSLong                refCon;
  119.     ODBoolean            fromTypeIsDesc;
  120. };
  121.  
  122. #if PRAGMA_ALIGN_SUPPORTED
  123. #pragma options align=reset
  124. #endif
  125.  
  126. struct SIEventHandlerKey
  127. {
  128.     ODEventClass    eventClass;
  129.     ODEventID        eventID;
  130. };
  131.  
  132. struct SIEventHandlerValue
  133. {
  134.     ODEventHandlerUPP    handler;
  135.     ODSLong                refCon;
  136. };
  137.  
  138. struct SIObjectAccessorKey
  139. {
  140.     ODDescType        desiredClass;
  141.     ODDescType        containerType;
  142. };
  143.  
  144. struct SIObjectAccessorValue
  145. {
  146.     ODObjectAccessorUPP    accessor;
  147.     ODSLong                refCon;
  148. };
  149.  
  150. struct SICoercionHandlerKey
  151. {
  152.     ODDescType        fromType;
  153.     ODDescType        toType;
  154. };
  155.  
  156. // [gsf] hash table imposes a maxsize limit of 10 bytes
  157. // when aligned for PPC, this struct is 12 bytes
  158.  
  159. #if PRAGMA_ALIGN_SUPPORTED
  160. #pragma options align=mac68k
  161. #endif
  162.  
  163. struct SICoercionHandlerValue
  164. {
  165.     ODCoercionHandlerUPP    handler;
  166.     ODSLong                    refCon;
  167.     ODBoolean                fromTypeIsDesc;
  168. };
  169.  
  170. #if PRAGMA_ALIGN_SUPPORTED
  171. #pragma options align=reset
  172. #endif
  173.  
  174. //==============================================================================
  175. // Constants
  176. //==============================================================================
  177.  
  178. // for hash tables
  179.  
  180. const ODULong    kNumInitialSIHashTableEntries = 8;
  181.  
  182. const ODBoolean    kNotInSystemHeap = false;
  183.  
  184. const ODBoolean    kODSEUnusedBoolParam = 0;
  185.  
  186. //------------------------------------------------------------------------------
  187. // Functions
  188. //------------------------------------------------------------------------------
  189.  
  190. //------------------------------------------------------------------------------
  191. // NewSIHashTable
  192. //
  193. //    Creates, initializes and returns new SIHashTable object.
  194. //------------------------------------------------------------------------------
  195.  
  196. static SIHashTable* NewSIHashTable()
  197. {
  198.     SIHashTable*    table = new SIHashTable;
  199.     table->Initialize(kNumInitialSIHashTableEntries, sizeof(SIEventHandlerKey),
  200.                         sizeof(SIEventHandlerValue), kNotInSystemHeap);
  201.     return table;
  202. }
  203.  
  204. //------------------------------------------------------------------------------
  205. // NewSICoercionHashTable
  206. //
  207. //    Creates, initializes and returns new SIHashTable object.
  208. //------------------------------------------------------------------------------
  209.  
  210. static SIHashTable* NewSICoercionHashTable()
  211. {
  212.     SIHashTable*    table = new SIHashTable;
  213.     table->Initialize(kNumInitialSIHashTableEntries, sizeof(SICoercionHandlerKey),
  214.                         sizeof(SICoercionHandlerValue), kNotInSystemHeap);
  215.     return table;
  216. }
  217.  
  218. //------------------------------------------------------------------------------
  219. // ThrowIfBadHandler
  220. //
  221. //    Throws paramErr if the handler is odd or null.
  222. //------------------------------------------------------------------------------
  223.  
  224. static void ThrowIfBadHandler(UniversalProcPtr proc)
  225. {
  226.     if ((proc == (UniversalProcPtr)kODNULL)
  227.             || ((ODULong)proc & 1))
  228.         THROW(paramErr);
  229. }
  230.  
  231. //------------------------------------------------------------------------------
  232. // ReturnCallbackFuncCaller
  233. //------------------------------------------------------------------------------
  234.  
  235. //extern "C" {
  236.  
  237. //CallbackCallerProc ReturnCallbackFuncCaller(OSLCallbackSelector whichCallback);
  238.  
  239. //}
  240.  
  241. //==============================================================================
  242. // SIHelper
  243. //==============================================================================
  244.  
  245. //------------------------------------------------------------------------------
  246. // SIHelper::SIHelper
  247. //------------------------------------------------------------------------------
  248.  
  249. SIHelper::SIHelper()
  250. {
  251.     fEventHandlerTable         = kODNULL;
  252.     fObjectAccessorTable    = kODNULL;
  253.     fCoercionHandlerTable    = kODNULL;
  254.  
  255.     fCountProcPtr             = (ODCountUPP)kODNULL;
  256.     fCompareProcPtr             = (ODCompareUPP)kODNULL;
  257.     fDisposeTokenProcPtr    = (ODDisposeTokenUPP)kODNULL;
  258.     fErrDescProcPtr         = (ODGetErrDescUPP)kODNULL;
  259.     fGetMarkTokenProcPtr     = (ODGetMarkTokenUPP)kODNULL;
  260.     fMarkProcPtr            = (ODMarkUPP)kODNULL;
  261.     fAdjustMarksProcPtr     = (ODAdjustMarksUPP)kODNULL;
  262.     fPreDispatchProcPtr     = (ODPreDispatchUPP)kODNULL;
  263.     
  264.     fTokenInquiryProc         = (ODTokenInquiryUPP)kODNULL;
  265.  
  266.     fOSLSupportFlags = kAEIDoMinimum;
  267.  
  268.     fSemanticInterface = (ODSemanticInterface*)kODNULL;
  269. //    fNameResolver = kODNULL;
  270. }
  271.  
  272. //------------------------------------------------------------------------------
  273. // SIHelper::InitSIHelper
  274. //------------------------------------------------------------------------------
  275.  
  276. void SIHelper::InitSIHelper(ODSession* session, ODSemanticInterface* helpee)
  277. {
  278.     fSemanticInterface = helpee;
  279.  
  280.     fEventHandlerTable = NewSIHashTable();
  281.     fObjectAccessorTable = NewSIHashTable();
  282.     fCoercionHandlerTable = NewSICoercionHashTable();
  283.     
  284.     fNameResolver = session->GetNameResolver(somGetGlobalEnvironment());
  285. }
  286.  
  287. //------------------------------------------------------------------------------
  288. // SIHelper::~SIHelper
  289. //------------------------------------------------------------------------------
  290.  
  291. SIHelper::~SIHelper()
  292. {
  293.     if ( fEventHandlerTable )
  294.         delete fEventHandlerTable;
  295.  
  296.     if ( fObjectAccessorTable )
  297.         delete fObjectAccessorTable;
  298.  
  299.     if ( fCoercionHandlerTable )
  300.         delete fCoercionHandlerTable;
  301. }
  302.  
  303. //------------------------------------------------------------------------------
  304. // SIHelper::ThrowProcNotFound
  305. //
  306. //    Throws the error code according to the type of proc that wasn't found.
  307. //    errAEHandlerNotFound for coercion handlers and event handlers and
  308. //    errAEAccessorNotFound for object accessors.
  309. //------------------------------------------------------------------------------
  310.  
  311. void SIHelper::ThrowProcNotFound(SIHashTable* table)
  312. {
  313.     if (table == fObjectAccessorTable)
  314.         THROW(errAEAccessorNotFound);
  315.     else
  316.         THROW(errAEHandlerNotFound);
  317. }
  318.  
  319. //------------------------------------------------------------------------------
  320. // SIHelper::AddToTable
  321. //
  322. //    Adds a proc ptr to one of our SIHashTables. fromTypeIsDesc is only used
  323. //    when adding a coercion handler. fCoercionHandlerTable knows this.
  324. //
  325. //    For event handlers: key1 = AEEventClass, key2 = AEEventID
  326. //    For coercion handlers: key1 = fromType, key2 = toType
  327. //    For object accessors: key1 = desiredClass, key2 = containerClass
  328. //------------------------------------------------------------------------------
  329.  
  330. void SIHelper::AddToTable(DescType key1, DescType key2,
  331.                                             UniversalProcPtr    handler,
  332.                                             ODSLong        handlerRefCon,
  333.                                             ODBoolean        fromTypeIsDesc,
  334.                                             SIHashTable*    table)
  335. {
  336.     SIGenericKey    theKey;
  337.     SIGenericValue    theValue;
  338.     
  339.     ThrowIfBadHandler(handler);
  340.     
  341.     theKey.key1 = key1;
  342.     theKey.key2 = key2;
  343.     
  344.     theValue.handler = handler;
  345.     theValue.refCon = handlerRefCon;
  346.     theValue.fromTypeIsDesc = fromTypeIsDesc;
  347.     
  348.     table->ReplaceEntry((ODKeyPtr)&theKey, (ODEntryPtr)&theValue);
  349. }
  350.  
  351. //------------------------------------------------------------------------------
  352. // SIHelper::RetrieveFromTable
  353. //
  354. //    Retrieves a proc ptr from one of our SIHashTables. fromTypeIsDesc is only used
  355. //    when adding a coercion handler. fCoercionHandlerTable knows this.
  356. //
  357. //    For event handlers: key1 = AEEventClass, key2 = AEEventID
  358. //    For coercion handlers: key1 = fromType, key2 = toType
  359. //    For object accessors: key1 = desiredClass, key2 = containerClass
  360. //------------------------------------------------------------------------------
  361.  
  362. void SIHelper::RetrieveFromTable(DescType key1, DescType key2,
  363.                                                 UniversalProcPtr*        handler,
  364.                                                 ODSLong*        handlerRefCon,
  365.                                                 ODBoolean*        fromTypeIsDesc,
  366.                                                 SIHashTable*    table)
  367. {
  368.     SIGenericKey    theKey;
  369.     SIGenericValue    theValue;
  370.     
  371.     theKey.key1 = key1;
  372.     theKey.key2 = key2;
  373.     
  374.     if (table->GetValue((ODKeyPtr)&theKey, (ODEntryPtr)&theValue) != kODFalse)
  375.     {
  376.         *handler = theValue.handler;
  377.         *handlerRefCon = theValue.refCon;
  378.         *fromTypeIsDesc = theValue.fromTypeIsDesc;
  379.     }
  380.     else
  381.         ThrowProcNotFound(table);
  382. }
  383.  
  384. //------------------------------------------------------------------------------
  385. // SIHelper::RemoveFromTable
  386. //
  387. //    Removes a proc ptr from one of our SIHashTables. fromTypeIsDesc is only
  388. //    used when adding a coercion handler. fCoercionHandlerTable knows this.
  389. //
  390. //    For event handlers: key1 = AEEventClass, key2 = AEEventID
  391. //    For coercion handlers: key1 = fromType, key2 = toType
  392. //    For object accessors: key1 = desiredClass, key2 = containerClass
  393. //------------------------------------------------------------------------------
  394.  
  395. void SIHelper::RemoveFromTable(DescType            key1,
  396.                                                 DescType        key2,
  397.                                                 UniversalProcPtr    handler,
  398.                                                 SIHashTable*    table)
  399. {
  400.     SIGenericKey    theKey;
  401.     SIGenericValue    theValue;
  402.     ODBoolean        result;
  403.     
  404.     theKey.key1 = key1;
  405.     theKey.key2 = key2;
  406.     
  407.     result = table->GetValue((ODKeyPtr)&theKey, (ODEntryPtr)&theValue);
  408.  
  409.     if (result)
  410.     {
  411.         if (theValue.handler == (UniversalProcPtr)kODNULL
  412.             || theValue.handler == handler)
  413.             table->RemoveEntry((ODKeyPtr)&theKey);
  414.         else
  415.             ThrowProcNotFound(table);
  416.     }
  417.     else
  418.         ThrowProcNotFound(table);
  419. }
  420.  
  421. //------------------------------------------------------------------------------
  422. // SIHelper::CallEventHandler
  423. //------------------------------------------------------------------------------
  424.  
  425. ODError SIHelper::CallEventHandler(
  426.                                     ODPart* thePart,
  427.                                     ODAppleEvent* theODAppleEvent,
  428.                                     ODAppleEvent* reply)
  429. {
  430.     OSErr                result = noErr;
  431.     ODSLong                handlerRefCon;
  432.     AEEventClass        eventClass;
  433.     AEEventID            eventID;
  434.     ODEventHandlerUPP    proc;
  435.     AppleEvent            realEvent;
  436.  
  437.     TRY
  438.         ODDescToAEDesc(theODAppleEvent, &realEvent);
  439.         eventClass = (AEEventClass)GetSLongAttr(&realEvent,
  440.                                                 keyEventClassAttr);
  441.         eventID = (AEEventID)GetSLongAttr(&realEvent,
  442.                                             keyEventIDAttr);
  443.  
  444.         if (this->LookupEventHandler(eventClass, eventID, &proc,
  445.                                                     &handlerRefCon))
  446.         {
  447.             TRY // 1245972 - don't need to put exception handling here anymore.
  448.                 result = (OSErr)CallODEventHandlerProc(proc, thePart,
  449.                                                         theODAppleEvent,
  450.                                                         reply,
  451.                                                         handlerRefCon);
  452.             CATCH_ALL
  453.                 result = ErrorCode();
  454.             ENDTRY
  455.         }
  456.         else
  457.             result = errAEEventNotHandled;
  458.  
  459.         ODDisposeAppleEvent(&realEvent);
  460.     CATCH_ALL
  461.         result =  errAEEventNotHandled;
  462.     ENDTRY
  463.     
  464.     return result;
  465. }
  466.  
  467. //------------------------------------------------------------------------------
  468. // SIHelper::CallPredispatchProc
  469. //------------------------------------------------------------------------------
  470.  
  471. ODError SIHelper::CallPredispatchProc(
  472.                                     ODPart* thePart,
  473.                                     ODAppleEvent* theODAppleEvent,
  474.                                     ODAppleEvent* reply)
  475. {
  476.     OSErr    error;
  477.  
  478.     if (fPreDispatchProcPtr)
  479.         error = CallODPreDispatchProc(fPreDispatchProcPtr, thePart,
  480.                                         theODAppleEvent, reply,
  481.                                         fPreDispatchProcPtrRefCon);
  482.     else
  483.         error = errAEEventNotHandled;
  484.     
  485.     return error;
  486. }
  487.  
  488. //------------------------------------------------------------------------------
  489. // SIHelper::CallCoercionHandler
  490. //------------------------------------------------------------------------------
  491.  
  492. ODError SIHelper::CallCoercionHandler(
  493.                                         ODPart* thePart,
  494.                                         ODDesc* theODDesc,
  495.                                         ODDescType toType,
  496.                                         ODDesc* retDesc)
  497. {
  498.     OSErr                    result;
  499.     ODCoercionHandlerUPP    proc;
  500.     ODSLong                    refCon;
  501.     ODBoolean                fromTypeIsDesc;
  502.     AEDesc                    realInDesc;
  503.     AEDesc                    realOutDesc;
  504.  
  505.     ODDescToAEDesc(theODDesc, &realInDesc);
  506.     ODDescToAEDesc(retDesc, &realOutDesc);
  507.     if (this->LookupCoercionHandler(realInDesc.descriptorType, toType,
  508.                                     &proc, &refCon, &fromTypeIsDesc))
  509.     {
  510.         if (fromTypeIsDesc)
  511.         { // 1245972 - don't need to put exception handling here anymore.
  512.             TRY
  513.                 result = (OSErr)CallODDescCoercionHandlerProc(
  514.                                     (ODDescCoercionHandlerUPP)proc,
  515.                                     thePart,
  516.                                     theODDesc, toType,
  517.                                     refCon, retDesc);
  518.  
  519.             CATCH_ALL
  520.                 result = ErrorCode();
  521.             ENDTRY
  522.         }
  523.         else
  524.         {
  525.             ODLockHandle((ODHandle)realInDesc.dataHandle);
  526.             ODPtr dataPtr = *((ODPtr**)(realInDesc.dataHandle));
  527.             ODSize dataSize = ODGetHandleSize((ODHandle)realInDesc.dataHandle);
  528.  
  529.             // 1245972 - don't need to put exception handling here anymore.
  530.             TRY
  531.                 result = (OSErr)CallODPtrCoercionHandlerProc(
  532.                                     (ODPtrCoercionHandlerUPP)proc,
  533.                                     thePart,
  534.                                     realInDesc.descriptorType,
  535.                                     dataPtr, dataSize, toType,
  536.                                     refCon, retDesc);
  537.  
  538.             CATCH_ALL
  539.                 result = ErrorCode();
  540.             ENDTRY
  541.     
  542.             ODUnlockHandle((ODHandle)realInDesc.dataHandle);
  543.         }
  544.     }
  545.     else
  546.         result = errAECoercionFail;
  547.  
  548.     AEDisposeDesc(&realInDesc);
  549.     AEDisposeDesc(&realOutDesc);
  550.  
  551.     return result;
  552. }
  553.  
  554. //------------------------------------------------------------------------------
  555. // SIHelper::CallObjectAccessor
  556. //------------------------------------------------------------------------------
  557.  
  558. ODError SIHelper::CallObjectAccessor(
  559.                                         ODPart* thePart,
  560.                                         ODDescType desiredClass,
  561.                                         ODOSLToken* container,
  562.                                         ODDescType containerClass,
  563.                                         ODDescType form,
  564.                                         ODDesc* selectionData,
  565.                                         ODOSLToken* value)
  566. {
  567.     OSErr                result = noErr;
  568.     ODSLong                handlerRefCon;
  569.     ODObjectAccessorUPP    proc;
  570.     ODDesc*                userToken;
  571.     AEDesc                userAEToken;
  572.  
  573.     TRY
  574.  
  575.         /* THIS IS THE REAL CODE THAT SHOULD BE HERE. UNTIL WE ARE ALLOWED TO */
  576.         /* PASS THE SESSION TO INITSIHELPER, WE LIFT CODE FROM ELSEWHERE AND */
  577.         /* PLACE IT IN-LINE HERE. */
  578.  
  579.         userToken = fNameResolver->GetUserToken(somGetGlobalEnvironment(),
  580.                                                 container);
  581.         ODDescToAEDesc(userToken, &userAEToken);
  582.         DescType descType = userAEToken.descriptorType;
  583.         (void)AEDisposeDesc( &userAEToken );
  584.  
  585.         if (this->LookupObjectAccessor(desiredClass,
  586.                                         descType,
  587.                                         &proc, &handlerRefCon))
  588.         {
  589.             // 1245972 - don't need to put exception handling here anymore.
  590.             TRY
  591.                 result = (OSErr)CallODObjectAccessorProc(proc, thePart,
  592.                                                             desiredClass,
  593.                                                             container,
  594.                                                             containerClass,
  595.                                                             form, selectionData,
  596.                                                             value,
  597.                                                             handlerRefCon);
  598.             CATCH_ALL
  599.                 result = ErrorCode();
  600.             ENDTRY
  601.         }
  602.         else
  603.             result = errAEEventNotHandled;
  604.     CATCH_ALL
  605.         result =  errAEEventNotHandled;
  606.     ENDTRY
  607.     
  608.     return result;
  609. }
  610.  
  611. //------------------------------------------------------------------------------
  612. // SIHelper::CallCompareProc
  613. //------------------------------------------------------------------------------
  614.  
  615. ODError SIHelper::CallCompareProc(
  616.         ODPart* thePart,
  617.         ODDescType oper,
  618.         ODOSLToken* obj1,
  619.         ODOSLToken* obj2,
  620.         ODBoolean* result)
  621. {
  622.     OSErr    error;
  623.  
  624.     if (fCompareProcPtr)
  625.         error = CallODCompareProc(fCompareProcPtr, thePart, oper,
  626.                                     obj1, obj2, result, fCompareProcPtrRefCon);
  627.     else
  628.         error = errAEEventNotHandled;
  629.     
  630.     return error;
  631. }
  632.  
  633. //------------------------------------------------------------------------------
  634. // SIHelper::CallCountProc
  635. //------------------------------------------------------------------------------
  636.  
  637. ODError SIHelper::CallCountProc(
  638.         ODPart* thePart,
  639.         ODDescType desiredType,
  640.         ODDescType containerClass,
  641.         ODOSLToken* container,
  642.         ODSLong* result)
  643. {
  644.     OSErr    error;
  645.  
  646.     if (fCountProcPtr)
  647.         error = (OSErr)CallODCountProc(fCountProcPtr, thePart, desiredType,
  648.                                         containerClass, container,
  649.                                         result, fCountProcPtrRefCon);
  650.     else
  651.         error = errAEEventNotHandled;
  652.     
  653.     return error;
  654. }
  655.  
  656. //------------------------------------------------------------------------------
  657. // SIHelper::CallDisposeTokenProc
  658. //------------------------------------------------------------------------------
  659.  
  660. ODError SIHelper::CallDisposeTokenProc(
  661.         ODPart* thePart,
  662.         ODOSLToken* unneededToken)
  663. {
  664.     OSErr    error;
  665.  
  666.     if (fDisposeTokenProcPtr)
  667.         error = (OSErr)CallODDisposeTokenProc(fDisposeTokenProcPtr, thePart,
  668.                                                 unneededToken,
  669.                                                 fDisposeTokenProcPtrRefCon);
  670.     else
  671.         error = errAEEventNotHandled;
  672.     
  673.     return error;
  674. }
  675.  
  676. //------------------------------------------------------------------------------
  677. // SIHelper::CallGetErrDescProc
  678. //------------------------------------------------------------------------------
  679.  
  680. ODError SIHelper::CallGetErrDescProc(
  681.         ODPart* thePart,
  682.         ODDesc** errDesc)
  683. {
  684.     OSErr    error;
  685.  
  686.     if (fErrDescProcPtr)
  687.         error = (OSErr)CallODGetErrDescProc(fErrDescProcPtr, thePart, errDesc,
  688.                                             fErrDescProcPtrRefCon);
  689.     else
  690.         error = errAEEventNotHandled;
  691.     
  692.     return error;
  693. }
  694.  
  695. //------------------------------------------------------------------------------
  696. // SIHelper::CallGetMarkTokenProc
  697. //------------------------------------------------------------------------------
  698.  
  699. ODError SIHelper::CallGetMarkTokenProc(
  700.         ODPart* thePart,
  701.         ODOSLToken* dContainerToken,
  702.         ODDescType containerClass,
  703.         ODOSLToken* result)
  704. {
  705.     OSErr    error;
  706.  
  707.     if (fGetMarkTokenProcPtr)
  708.         error = (OSErr)CallODGetMarkTokenProc(fGetMarkTokenProcPtr, thePart,
  709.                                                 dContainerToken, containerClass,
  710.                                                 result,
  711.                                                 fGetMarkTokenProcPtrRefCon);
  712.     else
  713.         error = errAEEventNotHandled;
  714.     
  715.     return error;
  716. }
  717.  
  718. //------------------------------------------------------------------------------
  719. // SIHelper::CallMarkProc
  720. //------------------------------------------------------------------------------
  721.  
  722. ODError SIHelper::CallMarkProc(
  723.         ODPart* thePart,
  724.         ODOSLToken* dToken,
  725.         ODOSLToken* markToken,
  726.         ODSLong index)
  727. {
  728.     OSErr    error;
  729.  
  730.     if (fMarkProcPtr)
  731.         error = (OSErr)CallODMarkProc(fMarkProcPtr, thePart, dToken,
  732.                                                 markToken, index,
  733.                                                 fMarkProcPtrRefCon);
  734.     else
  735.         error = errAEEventNotHandled;
  736.     
  737.     return error;
  738. }
  739.  
  740. //------------------------------------------------------------------------------
  741. // SIHelper::CallAdjustMarksProc
  742. //------------------------------------------------------------------------------
  743.  
  744. ODError SIHelper::CallAdjustMarksProc(
  745.         ODPart* thePart,
  746.         ODSLong newStart,
  747.         ODSLong newStop,
  748.         ODOSLToken* markToken)
  749. {
  750.     OSErr    error;
  751.  
  752.     if (fAdjustMarksProcPtr)
  753.         error = (OSErr)CallODAdjustMarksProc(fAdjustMarksProcPtr, thePart,
  754.                                                 newStart, newStop, markToken,
  755.                                                 fAdjustMarksProcPtrRefCon);
  756.     else
  757.         error = errAEEventNotHandled;
  758.     
  759.     return error;
  760. }
  761.  
  762. //------------------------------------------------------------------------------
  763. // SIHelper::InstallObjectAccessor
  764. //------------------------------------------------------------------------------
  765.  
  766. void SIHelper::InstallObjectAccessor(ODDescType                desiredClass,
  767.                                         ODDescType            containerType,
  768.                                         ODObjectAccessorUPP    theAccessor,
  769.                                         ODSLong            accessorRefcon)
  770. {
  771.     this->AddToTable(desiredClass, containerType, (UniversalProcPtr)theAccessor,
  772.                         accessorRefcon, kODSEUnusedBoolParam,
  773.                         fObjectAccessorTable);
  774. }
  775.  
  776. //------------------------------------------------------------------------------
  777. // SIHelper::GetObjectAccessor
  778. //------------------------------------------------------------------------------
  779.  
  780. void SIHelper::GetObjectAccessor(ODDescType                desiredClass,
  781.                                    ODDescType                containerType,
  782.                                    ODObjectAccessorUPP*    theAccessor,
  783.                                    ODSLong*            accessorRefcon)
  784. {
  785.     ODBoolean    unusedBoolParam;
  786.  
  787.     this->RetrieveFromTable(desiredClass, containerType,
  788.                             (UniversalProcPtr*)theAccessor, accessorRefcon,
  789.                             &unusedBoolParam, fObjectAccessorTable);
  790. }
  791.  
  792. //------------------------------------------------------------------------------
  793. // SIHelper::RemoveObjectAccessor
  794. //------------------------------------------------------------------------------
  795.  
  796. void SIHelper::RemoveObjectAccessor(ODDescType            desiredClass,
  797.                                       ODDescType                containerType,
  798.                                       ODObjectAccessorUPP        theAccessor)
  799. {
  800.     this->RemoveFromTable(desiredClass, containerType, (UniversalProcPtr)theAccessor,
  801.                             fObjectAccessorTable);
  802. }
  803.  
  804. //------------------------------------------------------------------------------
  805. // SIHelper::InstallCompareProc
  806. //------------------------------------------------------------------------------
  807.  
  808. void SIHelper::InstallCompareProc(ODCompareUPP    compareProc,
  809.                                     ODSLong        refCon)
  810. {
  811.     ThrowIfBadHandler((UniversalProcPtr)compareProc);
  812.  
  813.     fCompareProcPtr = compareProc;
  814.     fCompareProcPtrRefCon = refCon;
  815. }
  816.  
  817. //------------------------------------------------------------------------------
  818. // SIHelper::InstallCountProc
  819. //------------------------------------------------------------------------------
  820.  
  821. void SIHelper::InstallCountProc(ODCountUPP    countProc,
  822.                                 ODSLong    refCon)
  823. {
  824.     ThrowIfBadHandler((UniversalProcPtr)countProc);
  825.  
  826.     fCountProcPtr = countProc;
  827.     fCountProcPtrRefCon = refCon;
  828. }
  829.  
  830. //------------------------------------------------------------------------------
  831. // SIHelper::InstallDisposeTokenProc
  832. //------------------------------------------------------------------------------
  833.  
  834. void SIHelper::InstallDisposeTokenProc(ODDisposeTokenUPP    disposeTokenProc,
  835.                                         ODSLong                    refCon)
  836. {
  837.     ThrowIfBadHandler((UniversalProcPtr)disposeTokenProc);
  838.  
  839.     fDisposeTokenProcPtr = disposeTokenProc;
  840.     fDisposeTokenProcPtrRefCon = refCon;
  841. }
  842.  
  843. //------------------------------------------------------------------------------
  844. // SIHelper::InstallGetMarkTokenProc
  845. //------------------------------------------------------------------------------
  846.  
  847. void SIHelper::InstallGetMarkTokenProc(ODGetMarkTokenUPP    getMarkTokenProc,
  848.                                         ODSLong                refCon)
  849. {
  850.     ThrowIfBadHandler((UniversalProcPtr)getMarkTokenProc);
  851.  
  852.     fGetMarkTokenProcPtr = getMarkTokenProc;
  853.     fGetMarkTokenProcPtrRefCon = refCon;
  854. }
  855.  
  856. //------------------------------------------------------------------------------
  857. // SIHelper::InstallMarkProc
  858. //------------------------------------------------------------------------------
  859.  
  860. void SIHelper::InstallMarkProc(ODMarkUPP    markProc,
  861.                                 ODSLong    refCon)
  862. {
  863.     ThrowIfBadHandler((UniversalProcPtr)markProc);
  864.  
  865.     fMarkProcPtr = markProc;
  866.     fMarkProcPtrRefCon = refCon;
  867. }
  868.  
  869. //------------------------------------------------------------------------------
  870. // SIHelper::InstallAdjustMarksProc
  871. //------------------------------------------------------------------------------
  872.  
  873. void SIHelper::InstallAdjustMarksProc(ODAdjustMarksUPP    adjustMarksProc,
  874.                                         ODSLong                refCon)
  875. {
  876.     ThrowIfBadHandler((UniversalProcPtr)adjustMarksProc);
  877.  
  878.     fAdjustMarksProcPtr = adjustMarksProc;
  879.     fAdjustMarksProcPtrRefCon = refCon;
  880. }
  881.  
  882. //------------------------------------------------------------------------------
  883. // SIHelper::InstallGetErrDescProc
  884. //------------------------------------------------------------------------------
  885.  
  886. void SIHelper::InstallGetErrDescProc(ODGetErrDescUPP    errorDescProc,
  887.                                         ODSLong            refCon)
  888. {
  889.     ThrowIfBadHandler((UniversalProcPtr)errorDescProc);
  890.  
  891.     fErrDescProcPtr = errorDescProc;
  892.     fErrDescProcPtrRefCon = refCon;
  893. }
  894.  
  895. //------------------------------------------------------------------------------
  896. // SIHelper::InstallTokenInquiryProc
  897. //------------------------------------------------------------------------------
  898.  
  899. void SIHelper::InstallTokenInquiryProc(ODTokenInquiryUPP    tokenInquiryProc,
  900.                                         ODSLong            refCon)
  901. {
  902.     ThrowIfBadHandler((UniversalProcPtr)tokenInquiryProc);
  903.  
  904.     fTokenInquiryProc = tokenInquiryProc;
  905.     fTokenInquiryProcRefCon = refCon;
  906. }
  907.  
  908. //------------------------------------------------------------------------------
  909. // SIHelper::InstallEventHandler
  910. //------------------------------------------------------------------------------
  911.  
  912. void SIHelper::InstallEventHandler(    ODEventClass            theAEEventClass,
  913.                                     ODEventID                theAEEventID,
  914.                                     ODEventHandlerUPP        handler,
  915.                                     ODSLong                    handlerRefCon)
  916. {
  917.     this->AddToTable(theAEEventClass, theAEEventID, (UniversalProcPtr)handler,
  918.                         handlerRefCon, kODSEUnusedBoolParam,
  919.                         fEventHandlerTable);
  920. //    fSemanticInterface->ForwardEvent(somGetGlobalEnvironment(), (ODBoolean)mode,
  921. //                                        theAEEventClass, theAEEventID);
  922. }
  923.  
  924. //------------------------------------------------------------------------------
  925. // SIHelper::RemoveEventHandler
  926. //------------------------------------------------------------------------------
  927.  
  928. void SIHelper::RemoveEventHandler(ODEventClass                    theAEEventClass,
  929.                                           ODEventID                    theAEEventID,
  930.                                           ODEventHandlerUPP    handler)
  931. {
  932.     this->RemoveFromTable(theAEEventClass, theAEEventID, (UniversalProcPtr)handler,
  933.                             fEventHandlerTable);
  934. }
  935.     
  936. //------------------------------------------------------------------------------
  937. // SIHelper::GetEventHandler
  938. //------------------------------------------------------------------------------
  939.  
  940. void SIHelper::GetEventHandler(ODEventClass                theAEEventClass,
  941.                                        ODEventID                theAEEventID,
  942.                                        ODEventHandlerUPP*        handler,
  943.                                        ODSLong*                handlerRefcon)
  944. {
  945.     ODBoolean    unusedBoolParam;
  946.  
  947.     this->RetrieveFromTable(theAEEventClass, theAEEventID,
  948.                             (UniversalProcPtr*)handler, handlerRefcon,
  949.                             &unusedBoolParam, fEventHandlerTable);
  950. }
  951.     
  952. //------------------------------------------------------------------------------
  953. // SIHelper::InstallCoercionHandler
  954. //------------------------------------------------------------------------------
  955.  
  956. void SIHelper::InstallCoercionHandler(ODDescType                    fromType,
  957.                                       ODDescType                toType,
  958.                                       ODCoercionHandlerUPP    handler,
  959.                                       ODSLong                handlerRefCon,
  960.                                       ODBoolean            fromTypeIsDesc)
  961. {
  962.     this->AddToTable(fromType, toType, (UniversalProcPtr)handler, handlerRefCon,
  963.                         fromTypeIsDesc, fCoercionHandlerTable);
  964. }
  965.  
  966. //------------------------------------------------------------------------------
  967. // SIHelper::RemoveCoercionHandler
  968. //------------------------------------------------------------------------------
  969.  
  970. void SIHelper::RemoveCoercionHandler(ODDescType                fromType,
  971.                                              ODDescType            toType,
  972.                                              ODCoercionHandlerUPP    handler)
  973. {
  974.     this->RemoveFromTable(fromType, toType, (UniversalProcPtr)handler,
  975.                             fCoercionHandlerTable);
  976. }
  977.     
  978. //------------------------------------------------------------------------------
  979. // SIHelper::GetCoercionHandler
  980. //------------------------------------------------------------------------------
  981.  
  982. void SIHelper::GetCoercionHandler(ODDescType                    fromType,
  983.                                           ODDescType                toType,
  984.                                           ODCoercionHandlerUPP*    handler,
  985.                                           ODSLong*                handlerRefcon,
  986.                                           ODBoolean*            fromTypeIsDesc)
  987. {
  988.     this->RetrieveFromTable(fromType, toType, (UniversalProcPtr*)handler, handlerRefcon,
  989.                             fromTypeIsDesc, fCoercionHandlerTable);
  990. }
  991.     
  992. //------------------------------------------------------------------------------
  993. // SIHelper::InstallSpecialHandler
  994. //------------------------------------------------------------------------------
  995.  
  996. void SIHelper::InstallSpecialHandler(AEKeyword                    functionClass,
  997.                                         ODSpecialHandlerUPP    handler,
  998.                                         ODSLong                refCon)
  999. {
  1000.     switch( functionClass )
  1001.     {
  1002.         case keyAECountProc:
  1003.             fCountProcPtr = (ODCountUPP)handler;
  1004.             fCountProcPtrRefCon = refCon;
  1005.             break;
  1006.         case keyAECompareProc:
  1007.             fCompareProcPtr = (ODCompareUPP)handler;
  1008.             fCompareProcPtrRefCon = refCon;
  1009.             break;
  1010.         case keyDisposeTokenProc:
  1011.             fDisposeTokenProcPtr = (ODDisposeTokenUPP)handler;
  1012.             fDisposeTokenProcPtrRefCon = refCon;
  1013.             break;
  1014.         case keyAEGetErrDescProc:
  1015.             fErrDescProcPtr = (ODGetErrDescUPP)handler;
  1016.             fErrDescProcPtrRefCon = refCon;
  1017.             break;
  1018.         case keyAEMarkTokenProc:
  1019.             fGetMarkTokenProcPtr = (ODGetMarkTokenUPP)handler;
  1020.             fGetMarkTokenProcPtrRefCon = refCon;
  1021.             break;
  1022.         case keyAEMarkProc:
  1023.             fMarkProcPtr = (ODMarkUPP)handler;
  1024.             fMarkProcPtrRefCon = refCon;
  1025.             break;
  1026.         case keyAEAdjustMarksProc:
  1027.             fAdjustMarksProcPtr = (ODAdjustMarksUPP)handler;
  1028.             fAdjustMarksProcPtrRefCon = refCon;
  1029.             break;
  1030.         case keyPreDispatch:
  1031.             fPreDispatchProcPtr = (ODPreDispatchUPP)handler;
  1032.             fPreDispatchProcPtrRefCon = refCon;
  1033.             fSemanticInterface->UsingPredispatchProc(somGetGlobalEnvironment(),
  1034.                                                         kODTrue);
  1035. //            fMessageInterface->PreHandlerAdded((ODPart*)this->GetBase(),
  1036. //                                                (ODPreDispatchUPP)handler,
  1037. //                                                refCon);
  1038.             break;
  1039.         default:
  1040.             THROW( errAENotASpecialFunction );
  1041.             break;
  1042.     }
  1043. }
  1044.     
  1045. //------------------------------------------------------------------------------
  1046. // SIHelper::RemoveSpecialHandler
  1047. //------------------------------------------------------------------------------
  1048.  
  1049. void SIHelper::RemoveSpecialHandler(AEKeyword                    functionClass,
  1050.                                                 ODSpecialHandlerUPP    handler)
  1051. {
  1052.     switch( functionClass )
  1053.     {
  1054.         case keyAECountProc:
  1055.             if (handler == (ODSpecialHandlerUPP)fCountProcPtr)
  1056.                 fCountProcPtr = (ODCountUPP)kODNULL;
  1057.             break;
  1058.         case keyAECompareProc:
  1059.             if (handler == (ODSpecialHandlerUPP)fCompareProcPtr )
  1060.                 fCompareProcPtr = (ODCompareUPP)kODNULL;
  1061.             break;
  1062.         case keyDisposeTokenProc:
  1063.             if (handler == (ODSpecialHandlerUPP)fDisposeTokenProcPtr )
  1064.                 fDisposeTokenProcPtr = (ODDisposeTokenUPP)kODNULL;
  1065.             break;
  1066.         case keyAEGetErrDescProc:
  1067.             if (handler == (ODSpecialHandlerUPP)fErrDescProcPtr )
  1068.                 fErrDescProcPtr = (ODGetErrDescUPP)kODNULL;
  1069.             break;
  1070.         case keyAEMarkTokenProc:
  1071.             if (handler == (ODSpecialHandlerUPP)fGetMarkTokenProcPtr )
  1072.                 fGetMarkTokenProcPtr = (ODGetMarkTokenUPP)kODNULL;
  1073.             break;
  1074.         case keyAEMarkProc:
  1075.             if (handler == (ODSpecialHandlerUPP)fMarkProcPtr )
  1076.                 fMarkProcPtr = (ODMarkUPP)kODNULL;
  1077.             break;
  1078.         case keyAEAdjustMarksProc:
  1079.             if (handler == (ODSpecialHandlerUPP)fAdjustMarksProcPtr )
  1080.                 fAdjustMarksProcPtr = (ODAdjustMarksUPP)kODNULL;
  1081.             break;
  1082.         case keyPreDispatch:
  1083.             if (handler == (ODSpecialHandlerUPP)fPreDispatchProcPtr )
  1084.             {
  1085.                 fPreDispatchProcPtr = (ODPreDispatchUPP)kODNULL;
  1086.                 fSemanticInterface->UsingPredispatchProc(somGetGlobalEnvironment(),
  1087.                                                             kODFalse);
  1088. //                fMessageInterface->PreHandlerRemoved((ODPart*)this->GetBase(),
  1089. //                                                    (ODPreDispatchUPP)handler,
  1090. //                                                    fPreDispatchProcPtrRefCon);
  1091.             }
  1092.             break;
  1093.         default:
  1094.             THROW( errAENotASpecialFunction );
  1095.             break;
  1096.     }
  1097. }
  1098.     
  1099. //------------------------------------------------------------------------------
  1100. // SIHelper::GetSpecialHandler
  1101. //------------------------------------------------------------------------------
  1102.  
  1103. void SIHelper::GetSpecialHandler(AEKeyword                    functionClass,
  1104.                                             ODSpecialHandlerUPP*    handler,
  1105.                                             ODSLong*                refCon)
  1106. {
  1107.     switch( functionClass )
  1108.     {
  1109.         case keyAECountProc:
  1110.             *handler = (ODSpecialHandlerUPP)fCountProcPtr;
  1111.             *refCon = fCountProcPtrRefCon;
  1112.             break;
  1113.         case keyAECompareProc:
  1114.             *handler = (ODSpecialHandlerUPP)fCompareProcPtr;
  1115.             *refCon = fCompareProcPtrRefCon;
  1116.             break;
  1117.         case keyDisposeTokenProc:
  1118.             *handler = (ODSpecialHandlerUPP)fDisposeTokenProcPtr;
  1119.             *refCon = fDisposeTokenProcPtrRefCon;
  1120.             break;
  1121.         case keyAEGetErrDescProc:
  1122.             *handler = (ODSpecialHandlerUPP)fErrDescProcPtr;
  1123.             *refCon = fErrDescProcPtrRefCon;
  1124.             break;
  1125.         case keyAEMarkTokenProc:
  1126.             *handler = (ODSpecialHandlerUPP)fGetMarkTokenProcPtr;
  1127.             *refCon = fGetMarkTokenProcPtrRefCon;
  1128.             break;
  1129.         case keyAEMarkProc:
  1130.             *handler = (ODSpecialHandlerUPP)fMarkProcPtr;
  1131.             *refCon = fMarkProcPtrRefCon;
  1132.             break;
  1133.         case keyAEAdjustMarksProc:
  1134.             *handler = (ODSpecialHandlerUPP)fAdjustMarksProcPtr;
  1135.             *refCon = fAdjustMarksProcPtrRefCon;
  1136.             break;
  1137.         case keyPreDispatch:
  1138.             *handler = (ODSpecialHandlerUPP)fPreDispatchProcPtr;
  1139.             *refCon = fPreDispatchProcPtrRefCon;
  1140.             break;
  1141.         default:
  1142.             THROW( errAENotASpecialFunction );
  1143.             break;
  1144.     }
  1145. }
  1146.  
  1147. //------------------------------------------------------------------------------
  1148. // SIHelper::LookupEventHandler
  1149. //------------------------------------------------------------------------------
  1150.  
  1151. ODBoolean SIHelper::LookupEventHandler(ODEventClass                eventClass,
  1152.                                    ODEventID                eventID,
  1153.                                    ODEventHandlerUPP*        handler,
  1154.                                    ODSLong*                handlerRefcon)
  1155. {
  1156.     SIEventHandlerValue    value;
  1157.     ODBoolean            result;
  1158.     
  1159.     result = HandlerLookup(eventClass, eventID , fEventHandlerTable,
  1160.                             &value);
  1161.  
  1162.     if (result)
  1163.     {
  1164.         *handler = value.handler;
  1165.         *handlerRefcon = value.refCon;
  1166.     }
  1167.     
  1168.     return result;
  1169. }
  1170.  
  1171. //------------------------------------------------------------------------------
  1172. // SIHelper::LookupCoercionHandler
  1173. //------------------------------------------------------------------------------
  1174.  
  1175. ODBoolean SIHelper::LookupCoercionHandler(ODDescType                fromType,
  1176.                                        ODDescType                toType,
  1177.                                        ODCoercionHandlerUPP*    handler,
  1178.                                        ODSLong*            handlerRefcon,
  1179.                                        ODBoolean*            fromTypeIsDesc)
  1180. {
  1181.     SICoercionHandlerValue    value;
  1182.     ODBoolean                result;
  1183.     
  1184.     result = HandlerLookup(fromType, toType, fCoercionHandlerTable,
  1185.                             (ODEntryPtr)&value);
  1186.     
  1187.     if (result)
  1188.     {
  1189.         *handler = value.handler;
  1190.         *handlerRefcon = value.refCon;
  1191.         *fromTypeIsDesc = value.fromTypeIsDesc;
  1192.     }
  1193.     
  1194.     return result;
  1195. }
  1196.  
  1197. //------------------------------------------------------------------------------
  1198. // SIHelper::LookupObjectAccessor
  1199. //------------------------------------------------------------------------------
  1200.  
  1201. ODBoolean SIHelper::LookupObjectAccessor(ODDescType                desiredClass,
  1202.                                        ODDescType                containerType,
  1203.                                        ODObjectAccessorUPP*    theAccessor,
  1204.                                        ODSLong*            accessorRefcon)
  1205. {
  1206.     SIObjectAccessorValue    value;
  1207.     ODBoolean                result;
  1208.     
  1209.     result = HandlerLookup(desiredClass, containerType , fObjectAccessorTable,
  1210.                             (ODEntryPtr)&value);
  1211.  
  1212.     if (result)
  1213.     {
  1214.         *theAccessor = value.accessor;
  1215.         *accessorRefcon = value.refCon;
  1216.     }
  1217.     
  1218.     return result;
  1219. }
  1220.  
  1221. //------------------------------------------------------------------------------
  1222. // SIHelper::GetOSLContext
  1223. //------------------------------------------------------------------------------
  1224.  
  1225. //OSLContext* SIHelper::GetOSLContext()
  1226. //{
  1227. //    return kODNULL;
  1228. //}
  1229.  
  1230. //------------------------------------------------------------------------------
  1231. // SIHelper::HandlerLookup
  1232. //------------------------------------------------------------------------------
  1233.  
  1234. ODBoolean SIHelper::HandlerLookup(
  1235.                                 ODDescType        key1,
  1236.                                 ODDescType        key2,
  1237.                                 SIHashTable*    theSIHashTable,
  1238.                                   void*        theValue)
  1239. {
  1240.     // This algorithm is duplicated in GetTableInfo in the AE Manager and
  1241.     //    OSLClAcc.GetTableInfo. Here we go, duplicating it again.
  1242.  
  1243.     SIGenericKey    key;
  1244.     ODBoolean        result;
  1245.     
  1246.     key.key1 = key1;
  1247.     key.key2 = key2;
  1248.  
  1249.     result = theSIHashTable->GetValue((ODKeyPtr)&key, theValue);
  1250.     if (!result)
  1251.     {
  1252.         key.key1 = typeWildCard;
  1253.         result = theSIHashTable->GetValue((ODKeyPtr)&key, theValue);
  1254.         if (!result)
  1255.         {
  1256.             key.key1 = key1;
  1257.             key.key2 = typeWildCard;
  1258.             result = theSIHashTable->GetValue((ODKeyPtr)&key, theValue);
  1259.             if (!result)
  1260.             {
  1261.                 key.key1 = typeWildCard;
  1262.                 result = theSIHashTable->GetValue((ODKeyPtr)&key, theValue);
  1263.             }
  1264.         }
  1265.     }
  1266.     
  1267.     return result;
  1268. }
  1269. #if 0
  1270. //------------------------------------------------------------------------------
  1271. // GetTokenDescType
  1272. //------------------------------------------------------------------------------
  1273.  
  1274. ODDescType GetTokenDescType(ODOSLToken* token)
  1275. {
  1276. }
  1277.  
  1278. //------------------------------------------------------------------------------
  1279. // SetTokenDescType
  1280. //------------------------------------------------------------------------------
  1281.  
  1282. void SetTokenDescType(ODOSLToken* token, ODDescType type)
  1283. {
  1284. }
  1285.  
  1286. //------------------------------------------------------------------------------
  1287. // GetTokenDataHandle
  1288. //------------------------------------------------------------------------------
  1289.  
  1290. ODHandle GetTokenDataHandle(ODOSLToken* token)
  1291. {
  1292. }
  1293.  
  1294. //------------------------------------------------------------------------------
  1295. // SetTokenDataHandle
  1296. //------------------------------------------------------------------------------
  1297.  
  1298. void SetTokenDataHandle(ODOSLToken* token, ODHandle handle)
  1299. {
  1300. }
  1301. #endif /* 0 */
  1302.  
  1303.